package jcommon.chap1_j2seplus.array;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public class PrintArray {
	public static void main(String[] args) {
		int[] intArray = new int[] { 2, 3, 4, 5, 6 };
		int[][] multiDimension = new int[][] { { 1, 2, 3 }, { 2, 3 },
				{ 5, 6, 7 } };
		System.out.println("intArray: " + ArrayUtils.toString(intArray));
		System.out.println("multiDimension: "
				+ ArrayUtils.toString(multiDimension));

		String[] strings = new String[] { "Blue", "Green", null, "Yellow" };
		System.out.println("Strings: " + ArrayUtils.toString(strings));
		System.out.println("Strings: " + ArrayUtils.toString(null, "Unknown"));
		System.out.println("Strings: "
				+ new ToStringBuilder(strings, new ToStringStyle() {
					private static final long serialVersionUID = 1L;
					{
						this.setUseClassName(false);
						this.setUseIdentityHashCode(false);
						this.setUseFieldNames(false);
						this.setContentStart("");
						this.setContentEnd("");
						this.setNullText("<Unknown>");
					}
				}).append(strings).toString());
		
		List<String> list = new ArrayList<String>( );
		list.add( "Foo" );
		list.add( "Blah" );
		System.out.println( list );
		System.out.println( ArrayUtils.toString( list.toArray( ) ) );
	}
}
